package com.vcredit.creditcat.service.speedloan;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;


public abstract class ProductCheckCustServiceAdaptor implements ApplicationContextAware{

	public static final String BEANNAME_PREFIX = "product_checkcust_service_";
	
	private ApplicationContext applicationContext;
	
	public void setApplicationContext(ApplicationContext applicationContext) {
		this.applicationContext = applicationContext;
	}
	
	
	/**
	 * 获取各产品对接service实现类
	 * @author zhaoqi01
	 * @param productId
	 * @return
	 */
	public IProductCheckCustService getProductCheckCustServiceImpl(Long productId) {
		try {
			return (IProductCheckCustService) applicationContext.getBean(BEANNAME_PREFIX + productId);
		} catch (BeansException e) {
		}
		
		return applicationContext.getBean(CommonCheckCustServiceImpl.class);
		
	}
	
}
